from django.db import models

# Create your models here.
class Users(models.Model):
    username = models.CharField(max_length=50)
    password = models.CharField(max_length=80)
    sex = models.IntegerField(default=1)
    address = models.CharField(max_length=255)
    code = models.CharField(max_length=6)
    phone = models.CharField(max_length=16)
    pic = models.CharField(max_length=50)
    state = models.IntegerField(default=1)
    addtime = models.DateTimeField(auto_now_add=True)

class Types(models.Model):
    name = models.CharField(max_length=50)
    pid = models.IntegerField()
    path = models.CharField(max_length=150)



class Goods(models.Model):
    typeid = models.IntegerField()
    title = models.CharField(max_length=255)
    company = models.CharField(max_length=50)
    descr = models.TextField()
    price = models.FloatField()
    picname = models.CharField(max_length=50)
    # 1 新添加  2在售 3下架
    state = models.IntegerField()
    store = models.IntegerField()
    num = models.IntegerField(null=True)
    clicknum = models.IntegerField(null=True)
    addtime = models.DateTimeField(auto_now_add=True)


# 订单表
class Orders(models.Model):
    uid = models.IntegerField()
    linkman = models.CharField(max_length=50)
    address = models.CharField(max_length=50)
    code = models.IntegerField()
    phone = models.CharField(max_length=11)
    addtime = models.DateTimeField(auto_now_add=True)
    total = models.FloatField()
    status = models.IntegerField()


# 订单详情表
class Odetail(models.Model):
    orderid = models.IntegerField()
    goodsid = models.IntegerField()
    title = models.CharField(max_length=50)
    price = models.FloatField()
    num = models.IntegerField()
    picname = models.CharField(max_length=50,default='1.jpg')


   




